package com.ztk.suanfa;

/**
 * 素数个数
 */
public class _02_Sushugeshu {

    public static void main(String[] args) {
        int primeNumber = primeNumber(8);
        System.out.println(primeNumber);
    }

    private static int primeNumber(int number) {
        if (number == 0 || number == 1) {
            return 0;
        }

        if (number == 2) {
            return 1;
        }

        if (number == 3) {
            return 2;
        }

        int primeNumber = 2;
        for (int i = 4; i <= number; i++) {
            if (i % 2 == 0 || i % 3 == 0) {
                continue;
            }
            primeNumber++;
        }
        return primeNumber;
    }
}
